Setup

Small utility function to visualize color palettes and a desatured version of the same palette with the help of the {prismatic} package.

plot_pal <- function(pal) { 
  plot(prismatic::color(pal))
  plot(prismatic::clr_desaturate(prismatic::color(pal), 1))
}

Corporate Colors

Retrieve single colors or a set of colors with omics_colors().

omics_colors("brand_blue")
## brand_blue 
##  "#3181de"
omics_colors(c("brand_blue", "red", "mid_grey"))
## brand_blue        red   mid_grey 
##  "#3181de"  "#f23451"  "#d8d8d8"
omics_colors()[1:3]
##  brand_blue bright_blue pastel_blue 
##   "#3181de"   "#2fb5e3"   "#81a1c1"

All Available Colors

plot_pal(omics_colors(1:16))

Corporate Color Palettes

Sequential Color Palettes

Single-hue sequential color palettes map a number of light to dark shades of the same color family to numeric values. Such color palettes are sued in case the main attention is on one end of the value range. The colors with the highest visual weight should be mapped to the values of interest.

Create sequential color palettes with omics_pal_c(). By default, the colors with the highest contrast are mapped to the highest values (optimal for most use cases).

Default: brand_blue

BS Color “Bleu De France” (primary)

plot_pal(omics_pal_c()(7))

bright_blue

plot_pal(omics_pal_c(palette = "bright_blue")(7))

pastel_blue

BS Color “Dark Pastel Blue” (secondary)

plot_pal(omics_pal_c(palette = "pastel_blue")(7))

red

plot_pal(omics_pal_c(palette = "red")(7))

terra_cotta

BS Color “Dark Terra Cotta” (warning)

plot_pal(omics_pal_c(palette = "terra_cotta")(7))

turquoise

BS Color “Viridian Green” (success)

plot_pal(omics_pal_c(palette = "turquoise")(7))

yellow

plot_pal(omics_pal_c(palette = "yellow")(7))

orange (BS Color “Indian Yellow = warning)

plot_pal(omics_pal_c(palette = "orange")(7))

purple

plot_pal(omics_pal_c(palette = "purple")(7))

green

plot_pal(omics_pal_c(palette = "green")(7))

light_green

plot_pal(omics_pal_c(palette = "light_green")(7))

grey

plot_pal(omics_pal_c(palette = "grey")(7))

Diverging Color Palettes

Diverging palettes are a gradient consisting of two hues that are blended towards the center values (midpoint). The palettes are designed in a way that colors usually associated with “bad” or “lows” such as red and orange are pointing towards the minimal values. Keep in mind that the midpoint should be picked with care and be meaningful to the reader (i.e. why are values below the midpoint different from those above the threshold?).

Create diverging color palettes with omics_pal_c(). By default, the alarming colors such as red, orange, and yellow are mapped to the lower, most often negative.

In general, there are two types of diverging palettes: those that blend two main colors and a version with grey as midpoint color.

brand_blue

plot_pal(omics_pal_c(palette = "blue_red")(7))

blue_orange

plot_pal(omics_pal_c(palette = "blue_orange")(7))

turq_yellow

plot_pal(omics_pal_c(palette = "turq_yellow")(7))

blue_red_grey

plot_pal(omics_pal_c(palette = "blue_red_grey")(7))

blue_orange

plot_pal(omics_pal_c(palette = "blue_orange_grey")(7))

turq_yellow_grey

plot_pal(omics_pal_c(palette = "turq_yellow_grey")(7))

Categorical Color Palettes

Categorical color palettes are used for qualitative data and should feature a number of distinct colors of similar visual weight. For most use cases, categorical colors should be limited to 4-6 and never exceed 8 categories.

Create categorical color palettes with omics_pal_d(). All categorical color palettes are for now variants of the same color palette called default. The categorical palette is limited to a eight unique colors, with the first being the brand blue. However, given the limited number of available colors palettes with more than four colors do not ensure similar visual weights.

default

plot_pal(omics_pal_d()(10))

dark

plot_pal(omics_pal_d(palette = "dark")(10))

super_dark

plot_pal(omics_pal_d(palette = "super_dark")(10))

light

plot_pal(omics_pal_d(palette = "light")(10))

super_light

plot_pal(omics_pal_d(palette = "super_light")(10))

muted

plot_pal(omics_pal_d(palette = "muted")(10))

Working with Color Palettes

Reverse a Palette

plot_pal(omics_pal_c(reverse = TRUE)(7))

plot_pal(omics_pal_c(palette = "blue_red_grey", reverse = TRUE)(7))

plot_pal(omics_pal_d(reverse = TRUE)(4))

Only Pick a Subset of Colors

plot_pal(omics_pal_d()(10)[c(1:3, 7, 10)])

Session Info
## [1] "2023-02-03 15:54:02 CET"
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 22621)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
## [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
## [5] LC_TIME=German_Germany.1252    
## system code page: 65001
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## loaded via a namespace (and not attached):
##  [1] rstudioapi_0.14   knitr_1.39        magrittr_2.0.3    munsell_0.5.0    
##  [5] colorspace_2.0-3  here_1.0.1        R6_2.5.1          ragg_1.2.2       
##  [9] rlang_1.0.4       fastmap_1.1.0     highr_0.9         stringr_1.4.1    
## [13] tools_4.1.0       xfun_0.31         cli_3.3.0         jquerylib_0.1.4  
## [17] htmltools_0.5.2   systemfonts_1.0.3 yaml_2.2.1        digest_0.6.29    
## [21] rprojroot_2.0.3   lifecycle_1.0.1   textshaping_0.3.6 farver_2.1.0     
## [25] sass_0.4.2        cachem_1.0.6      evaluate_0.16     rmarkdown_2.16   
## [29] stringi_1.7.5     compiler_4.1.0    bslib_0.4.0       scales_1.2.1     
## [33] prismatic_1.1.1   jsonlite_1.7.2